"""
键盘的操作：
键盘的执行方法：send_keys
面试：怎么操作鼠标键盘的
"""
import time
from idlelib.configdialog import KeysPage

from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By

# 1.创建浏览器驱动对象
driver=webdriver.Chrome()
# 2.通过get方法获取网页
driver.get("http://localhost:8081/regA.html")
ele=driver.find_element(By.ID,"userA")
ele.send_keys("admin1")
time.sleep(2)
ele.send_keys(Keys.BACKSPACE)
# 全选
ele.send_keys(Keys.CONTROL,"a")
time.sleep(2)
ele.send_keys(Keys.CONTROL,"c")
time.sleep(2)
ele=driver.find_element(By.ID,"passwordA")
ele.send_keys(Keys.CONTROL,"v")
time.sleep(2)
if ele.get_attribute("value")=="admin":
    print("是")
# 4.关闭浏览器对象
driver.quit()  # 关闭浏览器



